package com.chapter16.ThreadPoolExecutor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 宋鑫宇
 * @version 1.0
 * 使用Executors创建线程池对象
 */
public class ThreadPool_ {
    public static void main(String[] args) {
        //创建固定线程数量的线程池
        //大型高并发项目使用Executors创建线程可能会出现系统风险
        ExecutorService pool = Executors.newFixedThreadPool(3);
        //
        pool.execute(new A());
        pool.execute(new A());
        pool.execute(new A());
        pool.execute(new A());
    }
}
